import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// 引入登录组件
import login from '@/views/login.vue'
//引入home组件
import home from '@/views/home.vue'
import register from '@/views/register.vue'
//侧边栏
import Phone from '../views/Nav_lists/Phone'
import HeadphonesSpeakers from '../views/Nav_lists/HeadphonesSpeakers.vue'
import LaptopsTablets from '../views/Nav_lists/LaptopsTablets.vue'
import Television from '../views/Nav_lists/Television.vue'
import TravelWearables from '../views/Nav_lists/TravelWearables.vue'


const routes = [
  {
    path: '/',
    redirect: '/home' // 将根路径重定向到 home 路由
  },
  //登录的路由规则
  {
    path: '/login',//路由地址
    name: 'login',
    component: login//相对应的组件
  },
  //注册
  {
    path: '/register',//路由地址
    name: 'register',
    component: register//相对应的组件
  },
  //home
  {
    path: '/home',//路由地址
    name: 'home',
    component: home//相对应的组件
  },
  //侧边栏
  {
    path: '/Phone',//路由地址
    name: 'Phone',
    component: Phone//相对应的组件
  },

  {
    path: '/HeadphonesSpeakers',//路由地址
    name: 'HeadphonesSpeakers',
    component: HeadphonesSpeakers//相对应的组件
  },
  {
    path: '/LaptopsTablets',//路由地址
    name: 'LaptopsTablets',
    component: LaptopsTablets//相对应的组件
  },
  {
    path: '/Television',//路由地址
    name: 'Television',
    component: Television//相对应的组件
  },
  {
    path: '/TravelWearables',//路由地址
    name: 'TravelWearables',
    component: TravelWearables//相对应的组件
  }
]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});


export default router
